Cleanup: move visibility/linkage attributes to the first declaration. This change moves visibility attributes from out-of-class method definitions to in-class declaration. This is needed for a switch to attribute((internal_linkage)) (see http://reviews.llvm.org/D13925) which can only appear on the first declaration. This change does not touch istream/ostream/streambuf. They are handled separately in http://reviews.llvm.org/D14409. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252385 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/bitset b/include/bitset index 8c278cc..b7d95a8 100644 --- a/include/bitset +++ b/include/bitset
@@ -168,7 +168,9 @@ typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT @@ -180,8 +182,11 @@ _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} + _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset& __v) _NOEXCEPT; void flip() _NOEXCEPT; @@ -192,6 +197,7 @@ bool all() const _NOEXCEPT; bool any() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT; private: #ifdef _LIBCPP_HAS_NO_CONSTEXPR @@ -199,15 +205,18 @@ void __init(unsigned long long __v, true_type) _NOEXCEPT; #endif // _LIBCPP_HAS_NO_CONSTEXPR unsigned long to_ulong(false_type) const; + _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong(true_type) const; unsigned long long to_ullong(false_type) const; + _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong(true_type) const; + _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong(true_type, false_type) const; unsigned long long to_ullong(true_type, true_type) const; }; template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT #ifndef _LIBCPP_HAS_NO_CONSTEXPR @@ -245,7 +254,7 @@ #endif // _LIBCPP_HAS_NO_CONSTEXPR template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #ifndef _LIBCPP_HAS_NO_CONSTEXPR @@ -264,7 +273,7 @@ } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT { @@ -273,7 +282,7 @@ } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT { @@ -282,7 +291,7 @@ } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT { @@ -325,7 +334,7 @@ } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long __bitset<_N_words, _Size>::to_ulong(true_type) const { @@ -348,7 +357,7 @@ } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type) const { @@ -356,7 +365,7 @@ } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type, false_type) const { @@ -414,7 +423,7 @@ } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline size_t __bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT { @@ -450,7 +459,9 @@ typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT @@ -462,23 +473,32 @@ _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} + _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const; + _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const; + _LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT; }; template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset() _NOEXCEPT : __first_(0) @@ -486,7 +506,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT : __first_(static_cast<__storage_type>(__v)) @@ -494,7 +514,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT { @@ -502,7 +522,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT { @@ -510,7 +530,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT { @@ -518,7 +538,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<1, _Size>::flip() _NOEXCEPT { @@ -528,7 +548,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long __bitset<1, _Size>::to_ulong() const { @@ -536,7 +556,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long long __bitset<1, _Size>::to_ullong() const { @@ -544,7 +564,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool __bitset<1, _Size>::all() const _NOEXCEPT { @@ -553,7 +573,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool __bitset<1, _Size>::any() const _NOEXCEPT { @@ -562,7 +582,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline size_t __bitset<1, _Size>::__hash_code() const _NOEXCEPT { @@ -593,7 +613,9 @@ typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT @@ -620,13 +642,13 @@ _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;} }; -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset() _NOEXCEPT { } -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT { @@ -663,16 +685,23 @@ _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); // 23.3.5.2 bitset operations: + _LIBCPP_INLINE_VISIBILITY bitset& operator&=(const bitset& __rhs) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset& operator|=(const bitset& __rhs) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset& operator^=(const bitset& __rhs) _NOEXCEPT; bitset& operator<<=(size_t __pos) _NOEXCEPT; bitset& operator>>=(size_t __pos) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset& set() _NOEXCEPT; bitset& set(size_t __pos, bool __val = true); + _LIBCPP_INLINE_VISIBILITY bitset& reset() _NOEXCEPT; bitset& reset(size_t __pos); + _LIBCPP_INLINE_VISIBILITY bitset operator~() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset& flip() _NOEXCEPT; bitset& flip(size_t __pos); @@ -680,28 +709,40 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {return base::__make_ref(__p);} _LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);} + _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const; + _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const; template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; template <class _CharT, class _Traits> + _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; template <class _CharT> + _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; + _LIBCPP_INLINE_VISIBILITY basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', char __one = '1') const; + _LIBCPP_INLINE_VISIBILITY size_t count() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;} + _LIBCPP_INLINE_VISIBILITY bool operator==(const bitset& __rhs) const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bool operator!=(const bitset& __rhs) const _NOEXCEPT; bool test(size_t __pos) const; + _LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();} + _LIBCPP_INLINE_VISIBILITY bitset operator<<(size_t __pos) const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset operator>>(size_t __pos) const _NOEXCEPT; private: @@ -774,7 +815,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT { @@ -783,7 +824,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT { @@ -792,7 +833,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT { @@ -821,7 +862,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::set() _NOEXCEPT { @@ -844,7 +885,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::reset() _NOEXCEPT { @@ -867,7 +908,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size> bitset<_Size>::operator~() const _NOEXCEPT { @@ -877,7 +918,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::flip() _NOEXCEPT { @@ -901,7 +942,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long bitset<_Size>::to_ulong() const { @@ -909,7 +950,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long long bitset<_Size>::to_ullong() const { @@ -932,7 +973,7 @@ template <size_t _Size> template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_string<_CharT, _Traits, allocator<_CharT> > bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { @@ -941,7 +982,7 @@ template <size_t _Size> template <class _CharT> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { @@ -949,7 +990,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_string<char, char_traits<char>, allocator<char> > bitset<_Size>::to_string(char __zero, char __one) const { @@ -957,7 +998,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline size_t bitset<_Size>::count() const _NOEXCEPT { @@ -965,7 +1006,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT { @@ -973,7 +1014,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT { @@ -994,7 +1035,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool bitset<_Size>::all() const _NOEXCEPT { @@ -1002,7 +1043,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool bitset<_Size>::any() const _NOEXCEPT { @@ -1010,7 +1051,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size> bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT { @@ -1020,7 +1061,7 @@ } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size> bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT {